﻿using System.Collections.ObjectModel;
using System.Windows.Controls;
using MaxStoreErp.Core.BaseClasses;
using MaxStoreErp.Core.Commands;

namespace MaxStoreShop.Core.ViewerBase
{
    public class ViewerViewModelBase<T> : ViewModelBase where T : EntityBase
    {
        T _selectedItem;
        ObservableCollection<T> _viewerData;
        bool _isDeleteEnabled = true;
        public RelayCommand EditSelectedItemCommand { get; set; }
        public RelayCommand AddNewItemCommand { get; set; }
        public RelayCommand DeleteItemCommand { get; set; }
        public Control TargetEditionElement { get; set; }

        public bool IsDeleteEnabled
        {
            get { return _isDeleteEnabled; }
            set { _isDeleteEnabled = value; }
        }

        public T SelectedItem
        {
            get { return _selectedItem; }
            set { OnPropertyChanged(ref _selectedItem, value, "SelectedItem"); }
        }

        public ObservableCollection<T> ViewerData
        {
            get { return _viewerData; }
            set { OnPropertyChanged(ref _viewerData, value, "ViewerData"); }
        }
    }
}
